<template>
  <a-breadcrumb-item>
    <slot>
      <a v-if="path || click" href="javascript: void(0)" @click="navTo">
        {{ name }}
      </a>
      <span v-else>{{ name }}</span>
    </slot>
  </a-breadcrumb-item>
</template>

<script>
export default {
  name: 'DBreadcrumbItem',
  props: {
    name: {
      type: String
    },
    path: {
      type: String
    },
    click: {
      type: Function
    }
  },
  methods: {
    navTo() {
      if (this.path) {
        this.$router.push(this.path);
      } else if (this.click) {
        this.click();
      }
    }
  }
};
</script>

<style lang="scss" scoped></style>
